<template>
	<view>
		<view class="ty-d">
			<view class="ty-title">扫码内容</view>
			<view class="ty-info">
				<view v-for="(item,obj) in info" :key="index">{{obj}}:{{item}}</view>
				<view>{{code}}</view>
			</view>
		</view>
	<view @click="set_info" class="ss">扫一扫</view>
	</view>
</template>

<script>
	import Base64 from "../../common/base64.js"
	export default{
		data(){
			return{
				info:{},
				code:''
			}
		},
		methods:{
			set_info(){
				let that = this
				uni.scanCode({
					// scanType:['datamatrix'],
					success (res) {
						  console.log("sss:"+ Base64.decode(res.rawData))
						  let code =  Base64.decode(res.rawData)
						  that.code = code
						console.log('1:'+ decodeURIComponent(res.rawData))
						console.log("2:"+decodeURIComponent(code))
						console.log('条码类型：' + JSON.stringify(res));
						that.info = res
						console.log('条码内容：' + res);
						
					},fail(srr) {
						console.log("ss",srr)
					}
				});
			},
		}
	}
</script>

<style>
	view{
		box-sizing: border-box;
		word-break:break-all
	}
	.ss{
		width: 220rpx;
		height: 80rpx;
		background: #F0AD4E;
		font-size: 32rpx;
		margin: 300rpx auto;
		text-align:  center;
		line-height: 80rpx;
		color: #fff;
		border-radius: 4px;
	}
	.ty-d{
		padding: 40rpx;
		width: 100%;
	}
	.ty-title{
		padding-bottom: 20rpx;
	}
	.ty-info{
		border: 1px solid #C8C7CC;
		padding: 8rpx;
		width: 100%;
		
	}
</style>
